#!/bin/bash
# Lists packages that we need to add to BlackArch as dependencies or optional
#  dependencies for other packages. This script generally is mostly correct.
# This script may called from any location but the script itself must
#  live in '$projectroot/scripts'.

cd "$(dirname "$0")/.."

for pack in packages/* broken/* ; do
	unset optdepends depends
	source "$pack/PKGBUILD"
	printf '%s\n' "${optdepends[@]}" "${depends[@]}"
done | sed 's/\(>\|<\|:\).*//' | sort -u |
while read dep ; do
	if ! pacman -Si $dep &>/dev/null &&
		[[ ! -d packages/$dep ]]
	then
		echo $dep
	fi
done
